package com.sqx.modules.agentUserMoney.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.agentUserMoney.entity.AgentUserMoney;
import com.sqx.modules.agentUserMoney.service.AgentUserMoneyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * 代理钱包-管理端
 * @author wuChang
 * @since 2024-03-22
 */
@RestController
@Api(value = "代理钱包-管理端", tags = {"代理钱包-管理端"})
@RequestMapping("/admin/agentUserMoney/")
public class AgentUserMoneyController {
    @Autowired
    private AgentUserMoneyService agentUserMoneyService;


    /**
     * 获取代理钱包列表
     * @param agentUserMoney 代理钱包
     */
    @ApiOperation("获取代理钱包列表")
    @GetMapping(value = "getAgentUserMoneyList")
    public Result getAgentUserMoneyList(Integer page, Integer limit, AgentUserMoney agentUserMoney) {

        return Result.success().put("data", agentUserMoneyService.getAgentUserMoneyList(page, limit, agentUserMoney));
    }


    @ApiOperation("修改代理钱包")
    @RequiresPermissions("sys:agentMoney:update")
    @GetMapping(value = "updateUserMoney")
    public Result updateUserMoney(Long sysUserId, Integer type, BigDecimal money) {

        return agentUserMoneyService.updateUserMoney(sysUserId,type,money);
    }

    @ApiOperation("获取代理收入排行榜")
    @GetMapping(value = "getAgentRank")
    public Result getAgentRank(Integer page,Integer limit){
        return Result.success().put("data", agentUserMoneyService.getAgentRank(page,limit));
    }
}